package com.yss.system.api.domain;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yss.common.core.annotation.EasyExcel;
import com.yss.common.core.utils.easyexecl.IntegerConverter;
import com.yss.common.core.utils.easyexecl.StringConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.yss.common.core.web.domain.BaseEntity;
import com.yss.common.core.xss.Xss;

import java.util.List;

/**
 * 通知公告表 sys_notice
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_notice")
public class SysNotice extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 公告ID
     */
    @ExcelIgnore
    @TableId("ID")
    private String id;

    /**
     * 公告标题
     */
    @ExcelProperty(value = "公告标题")
    @Xss(message = "公告标题不能包含脚本字符")
    @NotBlank(message = "公告标题不能为空")
    @Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
    @TableField("NOTICE_TITLE")
    private String noticeTitle;

    /**
     * 公告类型（1通知 2公告）
     */
    @ExcelProperty(value = "公告内容", converter = StringConverter.class)
    @EasyExcel(readConverterExp = "1=1通知,2=公告")
    @TableField("NOTICE_TYPE")
    private String noticeType;

    /**
     * 公告内容
     */
    @ExcelProperty(value = "公告内容")
    @TableField("NOTICE_CONTENT")
    private String noticeContent;

    /**
     * 公告状态（0正常 1关闭）
     */
    @ExcelProperty(value = "公告内容", converter = IntegerConverter.class)
    @EasyExcel(readConverterExp = "1=正常,2=停用")
    @TableField("STATUS")
    private Integer status;


    /**
     * 对应的角色信息
     */
    @ExcelProperty(value = "角色信息")
    @TableField("ROLES")
    private String roles;

    @ExcelIgnore
    @TableField(exist = false)
    private List<String> roleList;
}
